﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using System.IO;

namespace pLib
{
    /*
using System;
using System.Reflection;

class MyClass
{
    public static String val = "test";
    public static void Main()
    {
        FieldInfo myf = typeof(MyClass).GetField("val");
        Console.WriteLine(myf.GetValue(null));
        val = "hi";
        Console.WriteLine(myf.GetValue(null));
    }
}
     */

    public class MyReflection
    {
        public void GetAllEvent()
        {

        }

        public void GetAllPrivateMemeber(Type myType)
        {
            //
            // TODO: Add test logic	here
            //

            FieldInfo[] fields = myType.GetFields(BindingFlags.NonPublic |
                         BindingFlags.Instance);

            string s = string.Empty;
            foreach (FieldInfo fi in fields)
            {
                if (fi.Name.StartsWith("rbe"))
                {
                    // TODO: Save into Text Fields
                    s += fi.Name + "\n";
                }
            }

            using (StreamWriter sw = new StreamWriter(@"D:\workspace\test.txt"))//File.Open(fullPath, FileMode.CreateNew);)
            {
                sw.Write(s);
                sw.Flush();
                sw.Close();
            }
        }
    }
}
